#include <stdio.h>
#include <stdbool.h>

bool isUgly(int n) 
{
    while(n)
    {
        if(n % 2 == 0)
        {
            n = n / 2;
        }   
        else if(n % 5 == 0)
        {
            n = n / 5;
        }
        else if(n % 3 == 0)
        {
            n = n / 3;
        }
        else break;
    }
    if(n != 1 )
    return false;
    else
    return true;
}

int main()
{
    int n = 6;
    printf("%d\n",isUgly(n));
}